const initialState={
  count:1,
};

 export function countReducer(state=initialState,action){
  //根据不同的action修改state
  console.log(action);
  switch(action.type){
    case "plus":
      state.count++;
      //修改状态后要返回更新后的状态
      return {
        count:state.count
      };
      break;
    case "minus":
      state.count--;
      if(state.count<=0){
        state.count=0;
      }
      return{
        count:state.count
      };
      break;
    default:
      return state;
      break;
  }
}